<template>
  <a-modal
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-descriptions :title="formInfo.title">
      <a-descriptions-item label="学校">{{ formInfo.schid }}</a-descriptions-item>
      <a-descriptions-item label="学生">{{ formInfo.studentId }}</a-descriptions-item>

      <a-descriptions-item label="视力左">{{ formInfo.eyeLeftData }}</a-descriptions-item>
      <a-descriptions-item label="视力右">{{ formInfo.eyeRightData }}</a-descriptions-item>
      <a-descriptions-item label="矫正视力左">{{ formInfo.eyeLeftClassData }}</a-descriptions-item>
      <a-descriptions-item label="矫正视力右眼">{{ formInfo.eyeRightClassData }}</a-descriptions-item>
      <a-descriptions-item label="创建时间">{{ formInfo.createTime }}</a-descriptions-item>
     <!-- <a-descriptions-item label="视力表是否做 0 否 1 是">{{ this.$sysDictFilter(formInfo.workShilibiaoFlag, 'workShilibiaoFlag') }}</a-descriptions-item>
      <a-descriptions-item label="手动输入是否做 0 否 1 是">{{ this.$sysDictFilter(formInfo.workManualFlag, 'workManualFlag') }}</a-descriptions-item>
      <a-descriptions-item label="验光仪是否做 0 否 1 是">{{ this.$sysDictFilter(formInfo.workYanguangFlag, 'workYanguangFlag') }}</a-descriptions-item>
      <a-descriptions-item label="录入人-视力表">{{ formInfo.createByShilibiao }}</a-descriptions-item>
      <a-descriptions-item label="录入人-手动输入">{{ formInfo.createByManual }}</a-descriptions-item>
      <a-descriptions-item label="录入人-验光仪">{{ formInfo.createByYanguang }}</a-descriptions-item>
      <a-descriptions-item label="视力表-时间">{{ formInfo.dealTimeShilibiao }}</a-descriptions-item>
      <a-descriptions-item label="手动输入-时间">{{ formInfo.dealTimeManual }}</a-descriptions-item>
      <a-descriptions-item label="验光仪-时间">{{ formInfo.dealTimeYanguang }}</a-descriptions-item>-->
      <a-descriptions-item label="色觉">{{ formInfo.manualSeJue }}</a-descriptions-item>
      <a-descriptions-item label="眼位">{{ formInfo.manualYanWei }}</a-descriptions-item>
      <a-descriptions-item label="眼球运动">{{ formInfo.manualYanQiuYunDong }}</a-descriptions-item>
      <a-descriptions-item label="眼睑内翻倒睫">{{ formInfo.manualYanJianNeiFan }}</a-descriptions-item>
      <a-descriptions-item label="眼睑肿物">{{ formInfo.manualYanLianZhongWu }}</a-descriptions-item>
      <a-descriptions-item label="眼睑上睑下垂">{{ formInfo.manualYanLianShangLian }}</a-descriptions-item>
      <a-descriptions-item label="结膜充血">{{ formInfo.manualJieMoChongXie }}</a-descriptions-item>
      <a-descriptions-item label="结膜充血分泌物">{{ formInfo.manualJieMoChongXieMiWu }}</a-descriptions-item>
      <a-descriptions-item label="备注">{{ formInfo.manualRemark }}</a-descriptions-item>
      <a-descriptions-item label="右球镜">{{ formInfo.yanguangYouQiuJing }}</a-descriptions-item>
      <a-descriptions-item label="右柱镜">{{ formInfo.yanguangYouZhuJing }}</a-descriptions-item>
      <a-descriptions-item label="右轴位">{{ formInfo.yanguangYouZhouWei }}</a-descriptions-item>
      <a-descriptions-item label="左球镜">{{ formInfo.yanguangZuoQiuJing }}</a-descriptions-item>
      <a-descriptions-item label="左柱镜">{{ formInfo.yanguangZuoZhuJing }}</a-descriptions-item>
      <a-descriptions-item label="左轴位">{{ formInfo.yanguangZuoZhouWei }}</a-descriptions-item>
    </a-descriptions>
    <template slot="footer">
      <a-button @click="handleCancel" style="margin-right: .8rem">关闭</a-button>
    </template>
  </a-modal>
</template>

<script>
  import pick from 'lodash.pick'
  import { getAction } from '@/api/manage'

  export default {
    name: 'EyeStudentTestRecordView',
    components: {},
    data () {
      return {
        visible: false,
        confirmLoading: false,
        formInfo: {},
        url: {
          saveInfo: '/system/eyeStudentTestRecord/save',
          getInfo: '/system/eyeStudentTestRecord/info'
        }
      }
    },
    created () {
    },
    methods: {
      show (record) {
        this.formInfo = Object.assign({}, record)
        if (this.formInfo.id) {
          getAction(this.url.getInfo, { 'id': record.id }).then(res => {
            this.$nextTick(() => {
              this.formInfo = (pick(res.result.data
        , 'id'
        , 'studentId'
        , 'schid'
        , 'eyeLeftData'
        , 'eyeRightData'
        , 'eyeLeftClassData'
        , 'eyeRightClassData'
        , 'createTime'
        , 'workShilibiaoFlag'
        , 'workManualFlag'
        , 'workYanguangFlag'
        , 'createByShilibiao'
        , 'createByManual'
        , 'createByYanguang'
        , 'dealTimeShilibiao'
        , 'dealTimeManual'
        , 'dealTimeYanguang'
        , 'manualSeJue'
        , 'manualYanWei'
        , 'manualYanQiuYunDong'
        , 'manualYanJianNeiFan'
        , 'manualYanLianZhongWu'
        , 'manualYanLianShangLian'
        , 'manualJieMoChongXie'
        , 'manualJieMoChongXieMiWu'
        , 'manualRemark'
        , 'yanguangYouQiuJing'
        , 'yanguangYouZhuJing'
        , 'yanguangYouZhouWei'
        , 'yanguangZuoQiuJing'
        , 'yanguangZuoZhuJing'
        , 'yanguangZuoZhouWei'
              ))
            })
          })
        }
        this.visible = true
      },
                                                                                                                                                                                                                                                                              // 确定
      handleSubmit () {
        this.visible = false
      },
      // 关闭
      handleCancel () {
        this.close()
      },
      close () {
        this.visible = false
      }
    }
  }
</script>
